<template>
	<div class="system-menu-container">
		<div class="breadcrumb-box">
			<Breadcrumb />
		</div>
		<div class="page-main">
			<el-card shadow="hover" class="layout-padding-auto">
				<div class="system-user-search mb15">
					<el-input size="default" placeholder="制度名称-准入准出管理" style="max-width: 180px"> </el-input>
					<el-select size="default" placeholder="分类-全部" style="max-width: 180px">
						<el-option label="患者" value="1"></el-option>
						<el-option label="手术" value="2"></el-option>
						<el-option label="病区" value="3"></el-option>
					</el-select>

					<el-select size="default" placeholder="启用状态" style="max-width: 180px">
						<el-option label="成功" value="1"></el-option>
						<el-option label="失败" value="2"></el-option>
						<el-option label="其他" value="3"></el-option>
					</el-select>

					<el-date-picker size="default" type="date" placeholder="请选择" class="w100" style="max-width: 180px"> </el-date-picker>

					<el-button size="default" type="primary" class="ml10">
						<el-icon>
							<ele-Search />
						</el-icon>
						查询
					</el-button>
					<el-button size="default" type="" class="ml10">
						<el-icon>
							<ele-Refresh />
						</el-icon>
						重置
					</el-button>
				</div>
				<el-table :data="state.tableData.data" v-loading="state.tableData.loading" style="width: 100%">
					<el-table-column type="index" label="序号" width="60" />
					<el-table-column prop="name" label="制度名称" show-overflow-tooltip></el-table-column>
					<el-table-column prop="phone" label="制度分类" show-overflow-tooltip></el-table-column>
					<el-table-column prop="op_name" label="负责人" show-overflow-tooltip></el-table-column>
					<el-table-column prop="status" label="启用状态" show-overflow-tooltip>
            <el-switch
                class="ml-2"
                style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
            />
          </el-table-column>
					<el-table-column prop="op_time" label="启用状态" show-overflow-tooltip>
            <el-tag class="ml-2" type="success">启用中</el-tag>

          </el-table-column>
					<el-table-column prop="artificial_count" label="更新时间" show-overflow-tooltip></el-table-column>

					<el-table-column label="操作" width="100">
						<template #default="scope">
							<el-button size="small" text type="primary" @click="onOpenEditDic('edit', scope.row)">查看</el-button>
						</template>
					</el-table-column>
				</el-table>
				<el-pagination
					@size-change="onHandleSizeChange"
					@current-change="onHandleCurrentChange"
					class="mt15"
					:pager-count="5"
					:page-sizes="[10, 20, 30]"
					v-model:current-page="state.tableData.param.pageNum"
					background
					v-model:page-size="state.tableData.param.pageSize"
					layout="total, sizes, prev, pager, next, jumper"
					:total="state.tableData.total"
				>
				</el-pagination>
			</el-card>
		</div>
	</div>
</template>

<script setup name="systemDic">
import { ElMessageBox, ElMessage } from 'element-plus';

// 引入组件
const Breadcrumb = defineAsyncComponent(() => import('/@/layout/navBars/breadcrumb/breadcrumb.vue'));

// 定义变量内容
const state = reactive({
	tableData: {
		data: [],
		total: 0,
		loading: false,
		param: {
			pageNum: 1,
			pageSize: 10,
		},
	},
});

// 初始化表格数据
const getTableData = () => {
	state.tableData.loading = true;
	const data = [];
	for (let i = 0; i < 2; i++) {
		data.push({
			name: i === 0 ? '《抗菌药物管理》' : '院感管理相关制度',
      status:true,
			list: [],
		});
	}
	state.tableData.data = data;
	state.tableData.total = state.tableData.data.length;
	setTimeout(() => {
		state.tableData.loading = false;
	}, 500);
};

// 分页改变
const onHandleSizeChange = (val) => {
	state.tableData.param.pageSize = val;
	getTableData();
};
// 分页改变
const onHandleCurrentChange = (val) => {
	state.tableData.param.pageNum = val;
	getTableData();
};
// 页面加载时
onMounted(() => {
	getTableData();
});
</script>
